<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>EOS.IO: Math C++ API</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="eos-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">EOS.IO
   &#160;<span id="projectnumber">DAWN1.1.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Math C++ API<div class="ingroups"><a class="el" href="group__contractdev.html">How To Write Contracts</a> &raquo; <a class="el" href="group__mathapi.html">Math API</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Defines common math functions and helper types.  
<a href="#details">More...</a></p>
<div class="dynheader">
Collaboration diagram for Math C++ API:</div>
<div class="dyncontent">
<center><table><tr><td><img src="group__mathcppapi.png" border="0" alt="" usemap="#group____mathcppapi"/>
<map name="group____mathcppapi" id="group____mathcppapi">
<area shape="rect" id="node2" href="group__mathapi.html" title="Defines common math functions. " alt="" coords="5,5,83,32"/>
</map>
</td></tr></table></center>
</div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structeos_1_1uint128.html">eosio::uint128</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A struct that wraps <a class="el" href="structeos_1_1uint128.html" title="A struct that wraps uint128 integer and defines common operator overloads. ">uint128</a> integer and defines common operator overloads.  <a href="structeos_1_1uint128.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga23801e95fdf200a183909b3f4e819680"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#ga23801e95fdf200a183909b3f4e819680">eosio::multeq</a> (<a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;self, const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;other)</td></tr>
<tr class="memdesc:ga23801e95fdf200a183909b3f4e819680"><td class="mdescLeft">&#160;</td><td class="mdescRight">wraps multeq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a>  <a href="group__mathcppapi.html#ga23801e95fdf200a183909b3f4e819680">More...</a><br /></td></tr>
<tr class="separator:ga23801e95fdf200a183909b3f4e819680"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1ed045c04de3094739808554e3791359"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#ga1ed045c04de3094739808554e3791359">eosio::diveq</a> (<a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;self, const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;other)</td></tr>
<tr class="memdesc:ga1ed045c04de3094739808554e3791359"><td class="mdescLeft">&#160;</td><td class="mdescRight">wraps diveq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a>  <a href="group__mathcppapi.html#ga1ed045c04de3094739808554e3791359">More...</a><br /></td></tr>
<tr class="separator:ga1ed045c04de3094739808554e3791359"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga8cfe8cb6da0460d4502c320025bbd9c8"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ga8cfe8cb6da0460d4502c320025bbd9c8"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#ga8cfe8cb6da0460d4502c320025bbd9c8">eosio::min</a> (const T &amp;a, const T &amp;b)</td></tr>
<tr class="memdesc:ga8cfe8cb6da0460d4502c320025bbd9c8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Defined similar to <a class="el" href="group__mathcppapi.html#ga8cfe8cb6da0460d4502c320025bbd9c8" title="Defined similar to std::min() ">std::min()</a>  <a href="group__mathcppapi.html#ga8cfe8cb6da0460d4502c320025bbd9c8">More...</a><br /></td></tr>
<tr class="separator:ga8cfe8cb6da0460d4502c320025bbd9c8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga422f063ec99a30ab7a395f0fafeffcb2"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:ga422f063ec99a30ab7a395f0fafeffcb2"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__mathcppapi.html#ga422f063ec99a30ab7a395f0fafeffcb2">eosio::max</a> (const T &amp;a, const T &amp;b)</td></tr>
<tr class="memdesc:ga422f063ec99a30ab7a395f0fafeffcb2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Define similar to <a class="el" href="group__mathcppapi.html#ga422f063ec99a30ab7a395f0fafeffcb2" title="Define similar to std::max() ">std::max()</a>  <a href="group__mathcppapi.html#ga422f063ec99a30ab7a395f0fafeffcb2">More...</a><br /></td></tr>
<tr class="separator:ga422f063ec99a30ab7a395f0fafeffcb2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga1ed045c04de3094739808554e3791359"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void eosio::diveq </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>other</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Divide two 128 bit unsigned integers and assign the value to the first parameter. It will throw an exception if other is zero. This wraps diveq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a> </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>Numerator. It will be replaced with the result </td></tr>
    <tr><td class="paramname">other</td><td>Denominator</td></tr>
  </table>
  </dd>
</dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> <span class="keyword">self</span>(100);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> other(100);</div><div class="line"><a class="code" href="group__mathcppapi.html#ga1ed045c04de3094739808554e3791359">diveq</a>(<span class="keyword">self</span>, other);</div><div class="line">std::cout &lt;&lt; <span class="keyword">self</span>; <span class="comment">// Output: 1</span></div></div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga422f063ec99a30ab7a395f0fafeffcb2"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T eosio::max </td>
          <td>(</td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the greater of the given values. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">a</td><td>Value to compare </td></tr>
    <tr><td class="paramname">b</td><td>Value to compare </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The greater of a and b. If they are equivalent, returns a</dd></dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> a(1);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> b(2);</div><div class="line">std::cout &lt;&lt; <a class="code" href="group__mathcppapi.html#ga422f063ec99a30ab7a395f0fafeffcb2">max</a>(a, b); <span class="comment">// Output: 2</span></div></div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga8cfe8cb6da0460d4502c320025bbd9c8"></a>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename T &gt; </div>
      <table class="memname">
        <tr>
          <td class="memname">T eosio::min </td>
          <td>(</td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>a</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const T &amp;&#160;</td>
          <td class="paramname"><em>b</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Get the smaller of the given values </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">a</td><td>Value to compare </td></tr>
    <tr><td class="paramname">b</td><td>Value to compare </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>The smaller of a and b. If they are equivalent, returns a</dd></dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> a(1);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> b(2);</div><div class="line">std::cout &lt;&lt; <a class="code" href="group__mathcppapi.html#ga8cfe8cb6da0460d4502c320025bbd9c8">min</a>(a, b); <span class="comment">// Output: 1</span></div></div><!-- fragment --> 
</div>
</div>
<a class="anchor" id="ga23801e95fdf200a183909b3f4e819680"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void eosio::multeq </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>self</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> &amp;&#160;</td>
          <td class="paramname"><em>other</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Multiply two 128 bit unsigned integers and assign the value to the first parameter. This wraps multeq_i128 from <a class="el" href="group__mathcapi.html">Math C API</a>. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">self</td><td>Value to be multiplied. It will be replaced with the result </td></tr>
    <tr><td class="paramname">other</td><td>Value integer to be multiplied.</td></tr>
  </table>
  </dd>
</dl>
<p>Example: </p><div class="fragment"><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> <span class="keyword">self</span>(100);</div><div class="line"><a class="code" href="group__types.html#ga396787e5ec029b1205bd3e4cd9763e7d">uint128_t</a> other(100);</div><div class="line"><a class="code" href="group__mathcppapi.html#ga23801e95fdf200a183909b3f4e819680">multeq</a>(<span class="keyword">self</span>, other);</div><div class="line">std::cout &lt;&lt; <span class="keyword">self</span>; <span class="comment">// Output: 10000</span></div></div><!-- fragment --> 
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
